| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 1 | // -*- C++ -*- | 
|  | 2 | //===--------------------------- atomic -----------------------------------===// | 
|  | 3 | // | 
|  | 4 | // The LLVM Compiler Infrastructure | 
|  | 5 | // | 
|  | 6 | // This file is distributed under the University of Illinois Open Source | 
|  | 7 | // License. See LICENSE.TXT for details. | 
|  | 8 | // | 
|  | 9 | //===----------------------------------------------------------------------===// | 
|  | 10 |  | 
|  | 11 | #ifndef _LIBCPP_ATOMIC | 
|  | 12 | #define _LIBCPP_ATOMIC | 
|  | 13 |  | 
|  | 14 | /* | 
|  | 15 | atomic synopsis | 
|  | 16 |  | 
|  | 17 | namespace std | 
|  | 18 | { | 
|  | 19 |  | 
|  | 20 | // order and consistency | 
|  | 21 |  | 
|  | 22 | typedef enum memory_order | 
|  | 23 | { | 
| Howard Hinnant | d1176e2 | 2010-09-28 17:13:38 | [diff] [blame] | 24 | memory_order_relaxed, | 
|  | 25 | memory_order_consume, // load-consume | 
|  | 26 | memory_order_acquire, // load-acquire | 
|  | 27 | memory_order_release, // store-release | 
|  | 28 | memory_order_acq_rel, // store-release load-acquire | 
|  | 29 | memory_order_seq_cst // store-release load-acquire | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 30 | } memory_order; | 
|  | 31 |  | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 32 | template <class T> T kill_dependency(T y) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 33 |  | 
|  | 34 | // lock-free property | 
|  | 35 |  | 
| Howard Hinnant | 7b9d6a8 | 2013-01-21 20:39:41 | [diff] [blame] | 36 | #define ATOMIC_BOOL_LOCK_FREE unspecified | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 37 | #define ATOMIC_CHAR_LOCK_FREE unspecified | 
|  | 38 | #define ATOMIC_CHAR16_T_LOCK_FREE unspecified | 
|  | 39 | #define ATOMIC_CHAR32_T_LOCK_FREE unspecified | 
|  | 40 | #define ATOMIC_WCHAR_T_LOCK_FREE unspecified | 
|  | 41 | #define ATOMIC_SHORT_LOCK_FREE unspecified | 
|  | 42 | #define ATOMIC_INT_LOCK_FREE unspecified | 
|  | 43 | #define ATOMIC_LONG_LOCK_FREE unspecified | 
|  | 44 | #define ATOMIC_LLONG_LOCK_FREE unspecified | 
| Howard Hinnant | 7b9d6a8 | 2013-01-21 20:39:41 | [diff] [blame] | 45 | #define ATOMIC_POINTER_LOCK_FREE unspecified | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 46 |  | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 47 | // flag type and operations | 
|  | 48 |  | 
|  | 49 | typedef struct atomic_flag | 
|  | 50 | { | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 51 | bool test_and_set(memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 52 | bool test_and_set(memory_order m = memory_order_seq_cst) noexcept; | 
|  | 53 | void clear(memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 54 | void clear(memory_order m = memory_order_seq_cst) noexcept; | 
|  | 55 | atomic_flag() noexcept = default; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 56 | atomic_flag(const atomic_flag&) = delete; | 
|  | 57 | atomic_flag& operator=(const atomic_flag&) = delete; | 
|  | 58 | atomic_flag& operator=(const atomic_flag&) volatile = delete; | 
|  | 59 | } atomic_flag; | 
|  | 60 |  | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 61 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 62 | atomic_flag_test_and_set(volatile atomic_flag* obj) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 63 |  | 
|  | 64 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 65 | atomic_flag_test_and_set(atomic_flag* obj) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 66 |  | 
|  | 67 | bool | 
|  | 68 | atomic_flag_test_and_set_explicit(volatile atomic_flag* obj, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 69 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 70 |  | 
|  | 71 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 72 | atomic_flag_test_and_set_explicit(atomic_flag* obj, memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 73 |  | 
|  | 74 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 75 | atomic_flag_clear(volatile atomic_flag* obj) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 76 |  | 
|  | 77 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 78 | atomic_flag_clear(atomic_flag* obj) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 79 |  | 
|  | 80 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 81 | atomic_flag_clear_explicit(volatile atomic_flag* obj, memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 82 |  | 
|  | 83 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 84 | atomic_flag_clear_explicit(atomic_flag* obj, memory_order m) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 85 |  | 
|  | 86 | #define ATOMIC_FLAG_INIT see below | 
| Howard Hinnant | e738501 | 2010-10-19 16:51:18 | [diff] [blame] | 87 | #define ATOMIC_VAR_INIT(value) see below | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 88 |  | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 89 | template <class T> | 
|  | 90 | struct atomic | 
|  | 91 | { | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 92 | bool is_lock_free() const volatile noexcept; | 
|  | 93 | bool is_lock_free() const noexcept; | 
|  | 94 | void store(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 95 | void store(T desr, memory_order m = memory_order_seq_cst) noexcept; | 
|  | 96 | T load(memory_order m = memory_order_seq_cst) const volatile noexcept; | 
|  | 97 | T load(memory_order m = memory_order_seq_cst) const noexcept; | 
|  | 98 | operator T() const volatile noexcept; | 
|  | 99 | operator T() const noexcept; | 
|  | 100 | T exchange(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 101 | T exchange(T desr, memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 102 | bool compare_exchange_weak(T& expc, T desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 103 | memory_order s, memory_order f) volatile noexcept; | 
|  | 104 | bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 105 | bool compare_exchange_strong(T& expc, T desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 106 | memory_order s, memory_order f) volatile noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 107 | bool compare_exchange_strong(T& expc, T desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 108 | memory_order s, memory_order f) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 109 | bool compare_exchange_weak(T& expc, T desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 110 | memory_order m = memory_order_seq_cst) volatile noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 111 | bool compare_exchange_weak(T& expc, T desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 112 | memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 113 | bool compare_exchange_strong(T& expc, T desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 114 | memory_order m = memory_order_seq_cst) volatile noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 115 | bool compare_exchange_strong(T& expc, T desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 116 | memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 117 |  | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 118 | atomic() noexcept = default; | 
|  | 119 | constexpr atomic(T desr) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 120 | atomic(const atomic&) = delete; | 
|  | 121 | atomic& operator=(const atomic&) = delete; | 
|  | 122 | atomic& operator=(const atomic&) volatile = delete; | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 123 | T operator=(T) volatile noexcept; | 
|  | 124 | T operator=(T) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 125 | }; | 
|  | 126 |  | 
|  | 127 | template <> | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 128 | struct atomic<integral> | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 129 | { | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 130 | bool is_lock_free() const volatile noexcept; | 
|  | 131 | bool is_lock_free() const noexcept; | 
|  | 132 | void store(integral desr, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 133 | void store(integral desr, memory_order m = memory_order_seq_cst) noexcept; | 
|  | 134 | integral load(memory_order m = memory_order_seq_cst) const volatile noexcept; | 
|  | 135 | integral load(memory_order m = memory_order_seq_cst) const noexcept; | 
|  | 136 | operator integral() const volatile noexcept; | 
|  | 137 | operator integral() const noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 138 | integral exchange(integral desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 139 | memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 140 | integral exchange(integral desr, memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 141 | bool compare_exchange_weak(integral& expc, integral desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 142 | memory_order s, memory_order f) volatile noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 143 | bool compare_exchange_weak(integral& expc, integral desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 144 | memory_order s, memory_order f) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 145 | bool compare_exchange_strong(integral& expc, integral desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 146 | memory_order s, memory_order f) volatile noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 147 | bool compare_exchange_strong(integral& expc, integral desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 148 | memory_order s, memory_order f) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 149 | bool compare_exchange_weak(integral& expc, integral desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 150 | memory_order m = memory_order_seq_cst) volatile noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 151 | bool compare_exchange_weak(integral& expc, integral desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 152 | memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 153 | bool compare_exchange_strong(integral& expc, integral desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 154 | memory_order m = memory_order_seq_cst) volatile noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 155 | bool compare_exchange_strong(integral& expc, integral desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 156 | memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 157 |  | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 158 | integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 159 | fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 160 | integral fetch_add(integral op, memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 161 | integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 162 | fetch_sub(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 163 | integral fetch_sub(integral op, memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 164 | integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 165 | fetch_and(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 166 | integral fetch_and(integral op, memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 167 | integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 168 | fetch_or(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 169 | integral fetch_or(integral op, memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 170 | integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 171 | fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 172 | integral fetch_xor(integral op, memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 173 |  | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 174 | atomic() noexcept = default; | 
|  | 175 | constexpr atomic(integral desr) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 176 | atomic(const atomic&) = delete; | 
|  | 177 | atomic& operator=(const atomic&) = delete; | 
|  | 178 | atomic& operator=(const atomic&) volatile = delete; | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 179 | integral operator=(integral desr) volatile noexcept; | 
|  | 180 | integral operator=(integral desr) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 181 |  | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 182 | integral operator++(int) volatile noexcept; | 
|  | 183 | integral operator++(int) noexcept; | 
|  | 184 | integral operator--(int) volatile noexcept; | 
|  | 185 | integral operator--(int) noexcept; | 
|  | 186 | integral operator++() volatile noexcept; | 
|  | 187 | integral operator++() noexcept; | 
|  | 188 | integral operator--() volatile noexcept; | 
|  | 189 | integral operator--() noexcept; | 
|  | 190 | integral operator+=(integral op) volatile noexcept; | 
|  | 191 | integral operator+=(integral op) noexcept; | 
|  | 192 | integral operator-=(integral op) volatile noexcept; | 
|  | 193 | integral operator-=(integral op) noexcept; | 
|  | 194 | integral operator&=(integral op) volatile noexcept; | 
|  | 195 | integral operator&=(integral op) noexcept; | 
|  | 196 | integral operator|=(integral op) volatile noexcept; | 
|  | 197 | integral operator|=(integral op) noexcept; | 
|  | 198 | integral operator^=(integral op) volatile noexcept; | 
|  | 199 | integral operator^=(integral op) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 200 | }; | 
|  | 201 |  | 
|  | 202 | template <class T> | 
|  | 203 | struct atomic<T*> | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 204 | { | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 205 | bool is_lock_free() const volatile noexcept; | 
|  | 206 | bool is_lock_free() const noexcept; | 
|  | 207 | void store(T* desr, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 208 | void store(T* desr, memory_order m = memory_order_seq_cst) noexcept; | 
|  | 209 | T* load(memory_order m = memory_order_seq_cst) const volatile noexcept; | 
|  | 210 | T* load(memory_order m = memory_order_seq_cst) const noexcept; | 
|  | 211 | operator T*() const volatile noexcept; | 
|  | 212 | operator T*() const noexcept; | 
|  | 213 | T* exchange(T* desr, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 214 | T* exchange(T* desr, memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 215 | bool compare_exchange_weak(T*& expc, T* desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 216 | memory_order s, memory_order f) volatile noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 217 | bool compare_exchange_weak(T*& expc, T* desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 218 | memory_order s, memory_order f) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 219 | bool compare_exchange_strong(T*& expc, T* desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 220 | memory_order s, memory_order f) volatile noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 221 | bool compare_exchange_strong(T*& expc, T* desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 222 | memory_order s, memory_order f) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 223 | bool compare_exchange_weak(T*& expc, T* desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 224 | memory_order m = memory_order_seq_cst) volatile noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 225 | bool compare_exchange_weak(T*& expc, T* desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 226 | memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 227 | bool compare_exchange_strong(T*& expc, T* desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 228 | memory_order m = memory_order_seq_cst) volatile noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 229 | bool compare_exchange_strong(T*& expc, T* desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 230 | memory_order m = memory_order_seq_cst) noexcept; | 
|  | 231 | T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 232 | T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) noexcept; | 
|  | 233 | T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile noexcept; | 
|  | 234 | T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 235 |  | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 236 | atomic() noexcept = default; | 
|  | 237 | constexpr atomic(T* desr) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 238 | atomic(const atomic&) = delete; | 
|  | 239 | atomic& operator=(const atomic&) = delete; | 
|  | 240 | atomic& operator=(const atomic&) volatile = delete; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 241 |  | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 242 | T* operator=(T*) volatile noexcept; | 
|  | 243 | T* operator=(T*) noexcept; | 
|  | 244 | T* operator++(int) volatile noexcept; | 
|  | 245 | T* operator++(int) noexcept; | 
|  | 246 | T* operator--(int) volatile noexcept; | 
|  | 247 | T* operator--(int) noexcept; | 
|  | 248 | T* operator++() volatile noexcept; | 
|  | 249 | T* operator++() noexcept; | 
|  | 250 | T* operator--() volatile noexcept; | 
|  | 251 | T* operator--() noexcept; | 
|  | 252 | T* operator+=(ptrdiff_t op) volatile noexcept; | 
|  | 253 | T* operator+=(ptrdiff_t op) noexcept; | 
|  | 254 | T* operator-=(ptrdiff_t op) volatile noexcept; | 
|  | 255 | T* operator-=(ptrdiff_t op) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 256 | }; | 
|  | 257 |  | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 258 |  | 
|  | 259 | template <class T> | 
|  | 260 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 261 | atomic_is_lock_free(const volatile atomic<T>* obj) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 262 |  | 
|  | 263 | template <class T> | 
|  | 264 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 265 | atomic_is_lock_free(const atomic<T>* obj) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 266 |  | 
|  | 267 | template <class T> | 
|  | 268 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 269 | atomic_init(volatile atomic<T>* obj, T desr) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 270 |  | 
|  | 271 | template <class T> | 
|  | 272 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 273 | atomic_init(atomic<T>* obj, T desr) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 274 |  | 
|  | 275 | template <class T> | 
|  | 276 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 277 | atomic_store(volatile atomic<T>* obj, T desr) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 278 |  | 
|  | 279 | template <class T> | 
|  | 280 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 281 | atomic_store(atomic<T>* obj, T desr) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 282 |  | 
|  | 283 | template <class T> | 
|  | 284 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 285 | atomic_store_explicit(volatile atomic<T>* obj, T desr, memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 286 |  | 
|  | 287 | template <class T> | 
|  | 288 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 289 | atomic_store_explicit(atomic<T>* obj, T desr, memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 290 |  | 
|  | 291 | template <class T> | 
|  | 292 | T | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 293 | atomic_load(const volatile atomic<T>* obj) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 294 |  | 
|  | 295 | template <class T> | 
|  | 296 | T | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 297 | atomic_load(const atomic<T>* obj) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 298 |  | 
|  | 299 | template <class T> | 
|  | 300 | T | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 301 | atomic_load_explicit(const volatile atomic<T>* obj, memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 302 |  | 
|  | 303 | template <class T> | 
|  | 304 | T | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 305 | atomic_load_explicit(const atomic<T>* obj, memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 306 |  | 
|  | 307 | template <class T> | 
|  | 308 | T | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 309 | atomic_exchange(volatile atomic<T>* obj, T desr) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 310 |  | 
|  | 311 | template <class T> | 
|  | 312 | T | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 313 | atomic_exchange(atomic<T>* obj, T desr) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 314 |  | 
|  | 315 | template <class T> | 
|  | 316 | T | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 317 | atomic_exchange_explicit(volatile atomic<T>* obj, T desr, memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 318 |  | 
|  | 319 | template <class T> | 
|  | 320 | T | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 321 | atomic_exchange_explicit(atomic<T>* obj, T desr, memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 322 |  | 
|  | 323 | template <class T> | 
|  | 324 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 325 | atomic_compare_exchange_weak(volatile atomic<T>* obj, T* expc, T desr) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 326 |  | 
|  | 327 | template <class T> | 
|  | 328 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 329 | atomic_compare_exchange_weak(atomic<T>* obj, T* expc, T desr) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 330 |  | 
|  | 331 | template <class T> | 
|  | 332 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 333 | atomic_compare_exchange_strong(volatile atomic<T>* obj, T* expc, T desr) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 334 |  | 
|  | 335 | template <class T> | 
|  | 336 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 337 | atomic_compare_exchange_strong(atomic<T>* obj, T* expc, T desr) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 338 |  | 
|  | 339 | template <class T> | 
|  | 340 | bool | 
|  | 341 | atomic_compare_exchange_weak_explicit(volatile atomic<T>* obj, T* expc, | 
|  | 342 | T desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 343 | memory_order s, memory_order f) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 344 |  | 
|  | 345 | template <class T> | 
|  | 346 | bool | 
|  | 347 | atomic_compare_exchange_weak_explicit(atomic<T>* obj, T* expc, T desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 348 | memory_order s, memory_order f) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 349 |  | 
|  | 350 | template <class T> | 
|  | 351 | bool | 
|  | 352 | atomic_compare_exchange_strong_explicit(volatile atomic<T>* obj, | 
|  | 353 | T* expc, T desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 354 | memory_order s, memory_order f) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 355 |  | 
|  | 356 | template <class T> | 
|  | 357 | bool | 
|  | 358 | atomic_compare_exchange_strong_explicit(atomic<T>* obj, T* expc, | 
|  | 359 | T desr, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 360 | memory_order s, memory_order f) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 361 |  | 
|  | 362 | template <class Integral> | 
|  | 363 | Integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 364 | atomic_fetch_add(volatile atomic<Integral>* obj, Integral op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 365 |  | 
|  | 366 | template <class Integral> | 
|  | 367 | Integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 368 | atomic_fetch_add(atomic<Integral>* obj, Integral op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 369 |  | 
|  | 370 | template <class Integral> | 
|  | 371 | Integral | 
|  | 372 | atomic_fetch_add_explicit(volatile atomic<Integral>* obj, Integral op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 373 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 374 | template <class Integral> | 
|  | 375 | Integral | 
|  | 376 | atomic_fetch_add_explicit(atomic<Integral>* obj, Integral op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 377 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 378 | template <class Integral> | 
|  | 379 | Integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 380 | atomic_fetch_sub(volatile atomic<Integral>* obj, Integral op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 381 |  | 
|  | 382 | template <class Integral> | 
|  | 383 | Integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 384 | atomic_fetch_sub(atomic<Integral>* obj, Integral op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 385 |  | 
|  | 386 | template <class Integral> | 
|  | 387 | Integral | 
|  | 388 | atomic_fetch_sub_explicit(volatile atomic<Integral>* obj, Integral op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 389 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 390 | template <class Integral> | 
|  | 391 | Integral | 
|  | 392 | atomic_fetch_sub_explicit(atomic<Integral>* obj, Integral op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 393 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 394 | template <class Integral> | 
|  | 395 | Integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 396 | atomic_fetch_and(volatile atomic<Integral>* obj, Integral op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 397 |  | 
|  | 398 | template <class Integral> | 
|  | 399 | Integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 400 | atomic_fetch_and(atomic<Integral>* obj, Integral op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 401 |  | 
|  | 402 | template <class Integral> | 
|  | 403 | Integral | 
|  | 404 | atomic_fetch_and_explicit(volatile atomic<Integral>* obj, Integral op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 405 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 406 | template <class Integral> | 
|  | 407 | Integral | 
|  | 408 | atomic_fetch_and_explicit(atomic<Integral>* obj, Integral op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 409 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 410 | template <class Integral> | 
|  | 411 | Integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 412 | atomic_fetch_or(volatile atomic<Integral>* obj, Integral op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 413 |  | 
|  | 414 | template <class Integral> | 
|  | 415 | Integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 416 | atomic_fetch_or(atomic<Integral>* obj, Integral op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 417 |  | 
|  | 418 | template <class Integral> | 
|  | 419 | Integral | 
|  | 420 | atomic_fetch_or_explicit(volatile atomic<Integral>* obj, Integral op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 421 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 422 | template <class Integral> | 
|  | 423 | Integral | 
|  | 424 | atomic_fetch_or_explicit(atomic<Integral>* obj, Integral op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 425 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 426 | template <class Integral> | 
|  | 427 | Integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 428 | atomic_fetch_xor(volatile atomic<Integral>* obj, Integral op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 429 |  | 
|  | 430 | template <class Integral> | 
|  | 431 | Integral | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 432 | atomic_fetch_xor(atomic<Integral>* obj, Integral op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 433 |  | 
|  | 434 | template <class Integral> | 
|  | 435 | Integral | 
|  | 436 | atomic_fetch_xor_explicit(volatile atomic<Integral>* obj, Integral op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 437 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 438 | template <class Integral> | 
|  | 439 | Integral | 
|  | 440 | atomic_fetch_xor_explicit(atomic<Integral>* obj, Integral op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 441 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 442 |  | 
|  | 443 | template <class T> | 
|  | 444 | T* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 445 | atomic_fetch_add(volatile atomic<T*>* obj, ptrdiff_t op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 446 |  | 
|  | 447 | template <class T> | 
|  | 448 | T* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 449 | atomic_fetch_add(atomic<T*>* obj, ptrdiff_t op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 450 |  | 
|  | 451 | template <class T> | 
|  | 452 | T* | 
|  | 453 | atomic_fetch_add_explicit(volatile atomic<T*>* obj, ptrdiff_t op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 454 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 455 | template <class T> | 
|  | 456 | T* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 457 | atomic_fetch_add_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 458 |  | 
|  | 459 | template <class T> | 
|  | 460 | T* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 461 | atomic_fetch_sub(volatile atomic<T*>* obj, ptrdiff_t op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 462 |  | 
|  | 463 | template <class T> | 
|  | 464 | T* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 465 | atomic_fetch_sub(atomic<T*>* obj, ptrdiff_t op) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 466 |  | 
|  | 467 | template <class T> | 
|  | 468 | T* | 
|  | 469 | atomic_fetch_sub_explicit(volatile atomic<T*>* obj, ptrdiff_t op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 470 | memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 471 | template <class T> | 
|  | 472 | T* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 473 | atomic_fetch_sub_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m) noexcept; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 474 |  | 
|  | 475 | // Atomics for standard typedef types | 
|  | 476 |  | 
| Howard Hinnant | 6ae4705 | 2013-01-04 18:58:50 | [diff] [blame] | 477 | typedef atomic<bool> atomic_bool; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 478 | typedef atomic<char> atomic_char; | 
|  | 479 | typedef atomic<signed char> atomic_schar; | 
|  | 480 | typedef atomic<unsigned char> atomic_uchar; | 
|  | 481 | typedef atomic<short> atomic_short; | 
|  | 482 | typedef atomic<unsigned short> atomic_ushort; | 
|  | 483 | typedef atomic<int> atomic_int; | 
|  | 484 | typedef atomic<unsigned int> atomic_uint; | 
|  | 485 | typedef atomic<long> atomic_long; | 
|  | 486 | typedef atomic<unsigned long> atomic_ulong; | 
|  | 487 | typedef atomic<long long> atomic_llong; | 
|  | 488 | typedef atomic<unsigned long long> atomic_ullong; | 
|  | 489 | typedef atomic<char16_t> atomic_char16_t; | 
|  | 490 | typedef atomic<char32_t> atomic_char32_t; | 
|  | 491 | typedef atomic<wchar_t> atomic_wchar_t; | 
|  | 492 |  | 
|  | 493 | typedef atomic<int_least8_t> atomic_int_least8_t; | 
|  | 494 | typedef atomic<uint_least8_t> atomic_uint_least8_t; | 
|  | 495 | typedef atomic<int_least16_t> atomic_int_least16_t; | 
|  | 496 | typedef atomic<uint_least16_t> atomic_uint_least16_t; | 
|  | 497 | typedef atomic<int_least32_t> atomic_int_least32_t; | 
|  | 498 | typedef atomic<uint_least32_t> atomic_uint_least32_t; | 
|  | 499 | typedef atomic<int_least64_t> atomic_int_least64_t; | 
|  | 500 | typedef atomic<uint_least64_t> atomic_uint_least64_t; | 
|  | 501 |  | 
|  | 502 | typedef atomic<int_fast8_t> atomic_int_fast8_t; | 
|  | 503 | typedef atomic<uint_fast8_t> atomic_uint_fast8_t; | 
|  | 504 | typedef atomic<int_fast16_t> atomic_int_fast16_t; | 
|  | 505 | typedef atomic<uint_fast16_t> atomic_uint_fast16_t; | 
|  | 506 | typedef atomic<int_fast32_t> atomic_int_fast32_t; | 
|  | 507 | typedef atomic<uint_fast32_t> atomic_uint_fast32_t; | 
|  | 508 | typedef atomic<int_fast64_t> atomic_int_fast64_t; | 
|  | 509 | typedef atomic<uint_fast64_t> atomic_uint_fast64_t; | 
|  | 510 |  | 
|  | 511 | typedef atomic<intptr_t> atomic_intptr_t; | 
|  | 512 | typedef atomic<uintptr_t> atomic_uintptr_t; | 
|  | 513 | typedef atomic<size_t> atomic_size_t; | 
|  | 514 | typedef atomic<ptrdiff_t> atomic_ptrdiff_t; | 
|  | 515 | typedef atomic<intmax_t> atomic_intmax_t; | 
|  | 516 | typedef atomic<uintmax_t> atomic_uintmax_t; | 
|  | 517 |  | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 518 | // fences | 
|  | 519 |  | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 520 | void atomic_thread_fence(memory_order m) noexcept; | 
|  | 521 | void atomic_signal_fence(memory_order m) noexcept; | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 522 |  | 
|  | 523 | } // std | 
|  | 524 |  | 
|  | 525 | */ | 
|  | 526 |  | 
|  | 527 | #include <__config> | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 528 | #include <cstddef> | 
|  | 529 | #include <cstdint> | 
|  | 530 | #include <type_traits> | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 531 |  | 
| Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 | [diff] [blame] | 532 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 533 | #pragma GCC system_header | 
| Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 | [diff] [blame] | 534 | #endif | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 535 |  | 
| Jonathan Roelofs | 8d86b2e | 2014-09-05 19:45:05 | [diff] [blame] | 536 | #ifdef _LIBCPP_HAS_NO_THREADS | 
|  | 537 | #error <atomic> is not supported on this single threaded system | 
| Eric Fiselier | 00f4a49 | 2015-08-19 17:21:46 | [diff] [blame] | 538 | #endif | 
|  | 539 | #if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) | 
|  | 540 | #error <atomic> is not implemented | 
|  | 541 | #endif | 
| Jonathan Roelofs | 8d86b2e | 2014-09-05 19:45:05 | [diff] [blame] | 542 |  | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 543 | _LIBCPP_BEGIN_NAMESPACE_STD | 
|  | 544 |  | 
| Howard Hinnant | d1176e2 | 2010-09-28 17:13:38 | [diff] [blame] | 545 | typedef enum memory_order | 
|  | 546 | { | 
|  | 547 | memory_order_relaxed, memory_order_consume, memory_order_acquire, | 
|  | 548 | memory_order_release, memory_order_acq_rel, memory_order_seq_cst | 
|  | 549 | } memory_order; | 
|  | 550 |  | 
| Eric Fiselier | 00f4a49 | 2015-08-19 17:21:46 | [diff] [blame] | 551 | #if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 552 | namespace __gcc_atomic { | 
| Marshall Clow | e422021 | 2015-01-11 06:15:59 | [diff] [blame] | 553 | template <typename _Tp> | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 554 | struct __gcc_atomic_t { | 
| Eric Fiselier | a4ae16b | 2015-10-14 08:36:22 | [diff] [blame] | 555 | _LIBCPP_INLINE_VISIBILITY | 
|  | 556 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS | 
|  | 557 | __gcc_atomic_t() _NOEXCEPT = default; | 
|  | 558 | #else | 
|  | 559 | __gcc_atomic_t() _NOEXCEPT : __a_value() {} | 
|  | 560 | #endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS | 
| Eric Fiselier | 26edd80 | 2015-07-14 17:50:27 | [diff] [blame] | 561 | _LIBCPP_CONSTEXPR explicit __gcc_atomic_t(_Tp value) _NOEXCEPT | 
|  | 562 | : __a_value(value) {} | 
| Marshall Clow | e422021 | 2015-01-11 06:15:59 | [diff] [blame] | 563 | _Tp __a_value; | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 564 | }; | 
|  | 565 | #define _Atomic(x) __gcc_atomic::__gcc_atomic_t<x> | 
|  | 566 |  | 
| Marshall Clow | e422021 | 2015-01-11 06:15:59 | [diff] [blame] | 567 | template <typename _Tp> _Tp __create(); | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 568 |  | 
| Marshall Clow | e422021 | 2015-01-11 06:15:59 | [diff] [blame] | 569 | template <typename _Tp, typename _Td> | 
|  | 570 | typename enable_if<sizeof(_Tp()->__a_value = __create<_Td>()), char>::type | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 571 | __test_atomic_assignable(int); | 
| Marshall Clow | e422021 | 2015-01-11 06:15:59 | [diff] [blame] | 572 | template <typename _Tp, typename _Up> | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 573 | __two __test_atomic_assignable(...); | 
|  | 574 |  | 
| Marshall Clow | e422021 | 2015-01-11 06:15:59 | [diff] [blame] | 575 | template <typename _Tp, typename _Td> | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 576 | struct __can_assign { | 
|  | 577 | static const bool value = | 
| Marshall Clow | e422021 | 2015-01-11 06:15:59 | [diff] [blame] | 578 | sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char); | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 579 | }; | 
|  | 580 |  | 
| Eric Fiselier | a4ae16b | 2015-10-14 08:36:22 | [diff] [blame] | 581 | static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) { | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 582 | // Avoid switch statement to make this a constexpr. | 
|  | 583 | return __order == memory_order_relaxed ? __ATOMIC_RELAXED: | 
|  | 584 | (__order == memory_order_acquire ? __ATOMIC_ACQUIRE: | 
|  | 585 | (__order == memory_order_release ? __ATOMIC_RELEASE: | 
|  | 586 | (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST: | 
|  | 587 | (__order == memory_order_acq_rel ? __ATOMIC_ACQ_REL: | 
|  | 588 | __ATOMIC_CONSUME)))); | 
|  | 589 | } | 
|  | 590 |  | 
| Eric Fiselier | a4ae16b | 2015-10-14 08:36:22 | [diff] [blame] | 591 | static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) { | 
| Dan Albert | c101738 | 2015-01-06 18:39:37 | [diff] [blame] | 592 | // Avoid switch statement to make this a constexpr. | 
|  | 593 | return __order == memory_order_relaxed ? __ATOMIC_RELAXED: | 
|  | 594 | (__order == memory_order_acquire ? __ATOMIC_ACQUIRE: | 
|  | 595 | (__order == memory_order_release ? __ATOMIC_RELAXED: | 
|  | 596 | (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST: | 
|  | 597 | (__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE: | 
|  | 598 | __ATOMIC_CONSUME)))); | 
|  | 599 | } | 
|  | 600 |  | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 601 | } // namespace __gcc_atomic | 
|  | 602 |  | 
|  | 603 | template <typename _Tp> | 
|  | 604 | static inline | 
|  | 605 | typename enable_if< | 
|  | 606 | __gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value>::type | 
|  | 607 | __c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) { | 
|  | 608 | __a->__a_value = __val; | 
|  | 609 | } | 
|  | 610 |  | 
|  | 611 | template <typename _Tp> | 
|  | 612 | static inline | 
|  | 613 | typename enable_if< | 
|  | 614 | !__gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value && | 
|  | 615 | __gcc_atomic::__can_assign< _Atomic(_Tp)*, _Tp>::value>::type | 
|  | 616 | __c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) { | 
|  | 617 | // [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because | 
|  | 618 | // the default operator= in an object is not volatile, a byte-by-byte copy | 
|  | 619 | // is required. | 
|  | 620 | volatile char* to = reinterpret_cast<volatile char*>(&__a->__a_value); | 
|  | 621 | volatile char* end = to + sizeof(_Tp); | 
|  | 622 | char* from = reinterpret_cast<char*>(&__val); | 
|  | 623 | while (to != end) { | 
|  | 624 | *to++ = *from++; | 
|  | 625 | } | 
|  | 626 | } | 
|  | 627 |  | 
|  | 628 | template <typename _Tp> | 
|  | 629 | static inline void __c11_atomic_init(_Atomic(_Tp)* __a, _Tp __val) { | 
|  | 630 | __a->__a_value = __val; | 
|  | 631 | } | 
|  | 632 |  | 
|  | 633 | static inline void __c11_atomic_thread_fence(memory_order __order) { | 
|  | 634 | __atomic_thread_fence(__gcc_atomic::__to_gcc_order(__order)); | 
|  | 635 | } | 
|  | 636 |  | 
|  | 637 | static inline void __c11_atomic_signal_fence(memory_order __order) { | 
|  | 638 | __atomic_signal_fence(__gcc_atomic::__to_gcc_order(__order)); | 
|  | 639 | } | 
|  | 640 |  | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 641 | template <typename _Tp> | 
|  | 642 | static inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a, _Tp __val, | 
|  | 643 | memory_order __order) { | 
|  | 644 | return __atomic_store(&__a->__a_value, &__val, | 
|  | 645 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 646 | } | 
|  | 647 |  | 
|  | 648 | template <typename _Tp> | 
|  | 649 | static inline void __c11_atomic_store(_Atomic(_Tp)* __a, _Tp __val, | 
|  | 650 | memory_order __order) { | 
| Dan Albert | c101738 | 2015-01-06 18:39:37 | [diff] [blame] | 651 | __atomic_store(&__a->__a_value, &__val, | 
|  | 652 | __gcc_atomic::__to_gcc_order(__order)); | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 653 | } | 
|  | 654 |  | 
|  | 655 | template <typename _Tp> | 
|  | 656 | static inline _Tp __c11_atomic_load(volatile _Atomic(_Tp)* __a, | 
|  | 657 | memory_order __order) { | 
|  | 658 | _Tp __ret; | 
|  | 659 | __atomic_load(&__a->__a_value, &__ret, | 
|  | 660 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 661 | return __ret; | 
|  | 662 | } | 
|  | 663 |  | 
|  | 664 | template <typename _Tp> | 
|  | 665 | static inline _Tp __c11_atomic_load(_Atomic(_Tp)* __a, memory_order __order) { | 
|  | 666 | _Tp __ret; | 
|  | 667 | __atomic_load(&__a->__a_value, &__ret, | 
|  | 668 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 669 | return __ret; | 
|  | 670 | } | 
|  | 671 |  | 
|  | 672 | template <typename _Tp> | 
|  | 673 | static inline _Tp __c11_atomic_exchange(volatile _Atomic(_Tp)* __a, | 
|  | 674 | _Tp __value, memory_order __order) { | 
|  | 675 | _Tp __ret; | 
|  | 676 | __atomic_exchange(&__a->__a_value, &__value, &__ret, | 
|  | 677 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 678 | return __ret; | 
|  | 679 | } | 
|  | 680 |  | 
|  | 681 | template <typename _Tp> | 
|  | 682 | static inline _Tp __c11_atomic_exchange(_Atomic(_Tp)* __a, _Tp __value, | 
|  | 683 | memory_order __order) { | 
|  | 684 | _Tp __ret; | 
|  | 685 | __atomic_exchange(&__a->__a_value, &__value, &__ret, | 
|  | 686 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 687 | return __ret; | 
|  | 688 | } | 
|  | 689 |  | 
|  | 690 | template <typename _Tp> | 
|  | 691 | static inline bool __c11_atomic_compare_exchange_strong( | 
|  | 692 | volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, | 
|  | 693 | memory_order __success, memory_order __failure) { | 
|  | 694 | return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, | 
|  | 695 | false, | 
|  | 696 | __gcc_atomic::__to_gcc_order(__success), | 
| Dan Albert | c101738 | 2015-01-06 18:39:37 | [diff] [blame] | 697 | __gcc_atomic::__to_gcc_failure_order(__failure)); | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 698 | } | 
|  | 699 |  | 
|  | 700 | template <typename _Tp> | 
|  | 701 | static inline bool __c11_atomic_compare_exchange_strong( | 
|  | 702 | _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success, | 
|  | 703 | memory_order __failure) { | 
|  | 704 | return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, | 
|  | 705 | false, | 
|  | 706 | __gcc_atomic::__to_gcc_order(__success), | 
| Dan Albert | c101738 | 2015-01-06 18:39:37 | [diff] [blame] | 707 | __gcc_atomic::__to_gcc_failure_order(__failure)); | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 708 | } | 
|  | 709 |  | 
|  | 710 | template <typename _Tp> | 
|  | 711 | static inline bool __c11_atomic_compare_exchange_weak( | 
|  | 712 | volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, | 
|  | 713 | memory_order __success, memory_order __failure) { | 
|  | 714 | return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, | 
|  | 715 | true, | 
|  | 716 | __gcc_atomic::__to_gcc_order(__success), | 
| Dan Albert | c101738 | 2015-01-06 18:39:37 | [diff] [blame] | 717 | __gcc_atomic::__to_gcc_failure_order(__failure)); | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 718 | } | 
|  | 719 |  | 
|  | 720 | template <typename _Tp> | 
|  | 721 | static inline bool __c11_atomic_compare_exchange_weak( | 
|  | 722 | _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success, | 
|  | 723 | memory_order __failure) { | 
|  | 724 | return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, | 
|  | 725 | true, | 
|  | 726 | __gcc_atomic::__to_gcc_order(__success), | 
| Dan Albert | c101738 | 2015-01-06 18:39:37 | [diff] [blame] | 727 | __gcc_atomic::__to_gcc_failure_order(__failure)); | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 728 | } | 
|  | 729 |  | 
|  | 730 | template <typename _Tp> | 
|  | 731 | struct __skip_amt { enum {value = 1}; }; | 
|  | 732 |  | 
|  | 733 | template <typename _Tp> | 
|  | 734 | struct __skip_amt<_Tp*> { enum {value = sizeof(_Tp)}; }; | 
|  | 735 |  | 
|  | 736 | // FIXME: Haven't figured out what the spec says about using arrays with | 
|  | 737 | // atomic_fetch_add. Force a failure rather than creating bad behavior. | 
|  | 738 | template <typename _Tp> | 
|  | 739 | struct __skip_amt<_Tp[]> { }; | 
|  | 740 | template <typename _Tp, int n> | 
|  | 741 | struct __skip_amt<_Tp[n]> { }; | 
|  | 742 |  | 
|  | 743 | template <typename _Tp, typename _Td> | 
|  | 744 | static inline _Tp __c11_atomic_fetch_add(volatile _Atomic(_Tp)* __a, | 
|  | 745 | _Td __delta, memory_order __order) { | 
|  | 746 | return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value, | 
|  | 747 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 748 | } | 
|  | 749 |  | 
|  | 750 | template <typename _Tp, typename _Td> | 
|  | 751 | static inline _Tp __c11_atomic_fetch_add(_Atomic(_Tp)* __a, _Td __delta, | 
|  | 752 | memory_order __order) { | 
|  | 753 | return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value, | 
|  | 754 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 755 | } | 
|  | 756 |  | 
|  | 757 | template <typename _Tp, typename _Td> | 
|  | 758 | static inline _Tp __c11_atomic_fetch_sub(volatile _Atomic(_Tp)* __a, | 
|  | 759 | _Td __delta, memory_order __order) { | 
|  | 760 | return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value, | 
|  | 761 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 762 | } | 
|  | 763 |  | 
|  | 764 | template <typename _Tp, typename _Td> | 
|  | 765 | static inline _Tp __c11_atomic_fetch_sub(_Atomic(_Tp)* __a, _Td __delta, | 
|  | 766 | memory_order __order) { | 
|  | 767 | return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value, | 
|  | 768 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 769 | } | 
|  | 770 |  | 
|  | 771 | template <typename _Tp> | 
|  | 772 | static inline _Tp __c11_atomic_fetch_and(volatile _Atomic(_Tp)* __a, | 
|  | 773 | _Tp __pattern, memory_order __order) { | 
|  | 774 | return __atomic_fetch_and(&__a->__a_value, __pattern, | 
|  | 775 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 776 | } | 
|  | 777 |  | 
|  | 778 | template <typename _Tp> | 
|  | 779 | static inline _Tp __c11_atomic_fetch_and(_Atomic(_Tp)* __a, | 
|  | 780 | _Tp __pattern, memory_order __order) { | 
|  | 781 | return __atomic_fetch_and(&__a->__a_value, __pattern, | 
|  | 782 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 783 | } | 
|  | 784 |  | 
|  | 785 | template <typename _Tp> | 
|  | 786 | static inline _Tp __c11_atomic_fetch_or(volatile _Atomic(_Tp)* __a, | 
|  | 787 | _Tp __pattern, memory_order __order) { | 
|  | 788 | return __atomic_fetch_or(&__a->__a_value, __pattern, | 
|  | 789 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 790 | } | 
|  | 791 |  | 
|  | 792 | template <typename _Tp> | 
|  | 793 | static inline _Tp __c11_atomic_fetch_or(_Atomic(_Tp)* __a, _Tp __pattern, | 
|  | 794 | memory_order __order) { | 
|  | 795 | return __atomic_fetch_or(&__a->__a_value, __pattern, | 
|  | 796 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 797 | } | 
|  | 798 |  | 
|  | 799 | template <typename _Tp> | 
|  | 800 | static inline _Tp __c11_atomic_fetch_xor(volatile _Atomic(_Tp)* __a, | 
|  | 801 | _Tp __pattern, memory_order __order) { | 
|  | 802 | return __atomic_fetch_xor(&__a->__a_value, __pattern, | 
|  | 803 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 804 | } | 
|  | 805 |  | 
|  | 806 | template <typename _Tp> | 
|  | 807 | static inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a, _Tp __pattern, | 
|  | 808 | memory_order __order) { | 
|  | 809 | return __atomic_fetch_xor(&__a->__a_value, __pattern, | 
|  | 810 | __gcc_atomic::__to_gcc_order(__order)); | 
|  | 811 | } | 
| Eric Fiselier | 00f4a49 | 2015-08-19 17:21:46 | [diff] [blame] | 812 | #endif // _LIBCPP_HAS_GCC_ATOMIC_IMP | 
| Dan Albert | e8b4232 | 2014-08-09 23:51:51 | [diff] [blame] | 813 |  | 
| Howard Hinnant | d1176e2 | 2010-09-28 17:13:38 | [diff] [blame] | 814 | template <class _Tp> | 
|  | 815 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 816 | _Tp | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 817 | kill_dependency(_Tp __y) _NOEXCEPT | 
| Howard Hinnant | d1176e2 | 2010-09-28 17:13:38 | [diff] [blame] | 818 | { | 
|  | 819 | return __y; | 
|  | 820 | } | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 821 |  | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 822 | // general atomic<T> | 
|  | 823 |  | 
|  | 824 | template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value> | 
|  | 825 | struct __atomic_base // false | 
|  | 826 | { | 
| Howard Hinnant | 7eb9f1e | 2012-09-16 20:33:09 | [diff] [blame] | 827 | mutable _Atomic(_Tp) __a_; | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 828 |  | 
|  | 829 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 830 | bool is_lock_free() const volatile _NOEXCEPT | 
| Eric Fiselier | 7726a34 | 2015-06-13 00:23:07 | [diff] [blame] | 831 | { | 
| Eric Fiselier | 00f4a49 | 2015-08-19 17:21:46 | [diff] [blame] | 832 | #if defined(_LIBCPP_HAS_C_ATOMIC_IMP) | 
| Eric Fiselier | 7726a34 | 2015-06-13 00:23:07 | [diff] [blame] | 833 | return __c11_atomic_is_lock_free(sizeof(_Tp)); | 
|  | 834 | #else | 
|  | 835 | return __atomic_is_lock_free(sizeof(_Tp), 0); | 
|  | 836 | #endif | 
|  | 837 | } | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 838 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 839 | bool is_lock_free() const _NOEXCEPT | 
| Eric Fiselier | 7726a34 | 2015-06-13 00:23:07 | [diff] [blame] | 840 | {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 841 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 842 | void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 843 | {__c11_atomic_store(&__a_, __d, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 844 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 845 | void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 846 | {__c11_atomic_store(&__a_, __d, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 847 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 848 | _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 849 | {return __c11_atomic_load(&__a_, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 850 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 851 | _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 852 | {return __c11_atomic_load(&__a_, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 853 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 854 | operator _Tp() const volatile _NOEXCEPT {return load();} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 855 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 856 | operator _Tp() const _NOEXCEPT {return load();} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 857 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 858 | _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 859 | {return __c11_atomic_exchange(&__a_, __d, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 860 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 861 | _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 862 | {return __c11_atomic_exchange(&__a_, __d, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 863 | _LIBCPP_INLINE_VISIBILITY | 
|  | 864 | bool compare_exchange_weak(_Tp& __e, _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 865 | memory_order __s, memory_order __f) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 866 | {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 867 | _LIBCPP_INLINE_VISIBILITY | 
|  | 868 | bool compare_exchange_weak(_Tp& __e, _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 869 | memory_order __s, memory_order __f) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 870 | {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 871 | _LIBCPP_INLINE_VISIBILITY | 
|  | 872 | bool compare_exchange_strong(_Tp& __e, _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 873 | memory_order __s, memory_order __f) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 874 | {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 875 | _LIBCPP_INLINE_VISIBILITY | 
|  | 876 | bool compare_exchange_strong(_Tp& __e, _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 877 | memory_order __s, memory_order __f) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 878 | {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 879 | _LIBCPP_INLINE_VISIBILITY | 
|  | 880 | bool compare_exchange_weak(_Tp& __e, _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 881 | memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 882 | {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 883 | _LIBCPP_INLINE_VISIBILITY | 
|  | 884 | bool compare_exchange_weak(_Tp& __e, _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 885 | memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 886 | {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 887 | _LIBCPP_INLINE_VISIBILITY | 
|  | 888 | bool compare_exchange_strong(_Tp& __e, _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 889 | memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 890 | {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 891 | _LIBCPP_INLINE_VISIBILITY | 
|  | 892 | bool compare_exchange_strong(_Tp& __e, _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 893 | memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 894 | {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 895 |  | 
|  | 896 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 74f4da7 | 2013-05-02 20:18:43 | [diff] [blame] | 897 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS | 
|  | 898 | __atomic_base() _NOEXCEPT = default; | 
|  | 899 | #else | 
|  | 900 | __atomic_base() _NOEXCEPT : __a_() {} | 
|  | 901 | #endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS | 
|  | 902 |  | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 903 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 904 | _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {} | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 905 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 906 | __atomic_base(const __atomic_base&) = delete; | 
|  | 907 | __atomic_base& operator=(const __atomic_base&) = delete; | 
|  | 908 | __atomic_base& operator=(const __atomic_base&) volatile = delete; | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 909 | #else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS | 
|  | 910 | private: | 
|  | 911 | __atomic_base(const __atomic_base&); | 
|  | 912 | __atomic_base& operator=(const __atomic_base&); | 
|  | 913 | __atomic_base& operator=(const __atomic_base&) volatile; | 
|  | 914 | #endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 915 | }; | 
|  | 916 |  | 
|  | 917 | // atomic<Integral> | 
|  | 918 |  | 
|  | 919 | template <class _Tp> | 
|  | 920 | struct __atomic_base<_Tp, true> | 
|  | 921 | : public __atomic_base<_Tp, false> | 
|  | 922 | { | 
|  | 923 | typedef __atomic_base<_Tp, false> __base; | 
|  | 924 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 74f4da7 | 2013-05-02 20:18:43 | [diff] [blame] | 925 | __atomic_base() _NOEXCEPT _LIBCPP_DEFAULT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 926 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 927 | _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 928 |  | 
|  | 929 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 930 | _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 931 | {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 932 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 933 | _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 934 | {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 935 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 936 | _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 937 | {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 938 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 939 | _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 940 | {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 941 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 942 | _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 943 | {return __c11_atomic_fetch_and(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 944 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 945 | _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 946 | {return __c11_atomic_fetch_and(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 947 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 948 | _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 949 | {return __c11_atomic_fetch_or(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 950 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 951 | _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 952 | {return __c11_atomic_fetch_or(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 953 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 954 | _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 955 | {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 956 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 957 | _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 958 | {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 959 |  | 
|  | 960 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 961 | _Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 962 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 963 | _Tp operator++(int) _NOEXCEPT {return fetch_add(_Tp(1));} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 964 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 965 | _Tp operator--(int) volatile _NOEXCEPT {return fetch_sub(_Tp(1));} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 966 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 967 | _Tp operator--(int) _NOEXCEPT {return fetch_sub(_Tp(1));} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 968 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 969 | _Tp operator++() volatile _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 970 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 971 | _Tp operator++() _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 972 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 973 | _Tp operator--() volatile _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 974 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 975 | _Tp operator--() _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 976 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 977 | _Tp operator+=(_Tp __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 978 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 979 | _Tp operator+=(_Tp __op) _NOEXCEPT {return fetch_add(__op) + __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 980 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 981 | _Tp operator-=(_Tp __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 982 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 983 | _Tp operator-=(_Tp __op) _NOEXCEPT {return fetch_sub(__op) - __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 984 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 985 | _Tp operator&=(_Tp __op) volatile _NOEXCEPT {return fetch_and(__op) & __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 986 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 987 | _Tp operator&=(_Tp __op) _NOEXCEPT {return fetch_and(__op) & __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 988 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 989 | _Tp operator|=(_Tp __op) volatile _NOEXCEPT {return fetch_or(__op) | __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 990 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 991 | _Tp operator|=(_Tp __op) _NOEXCEPT {return fetch_or(__op) | __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 992 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 993 | _Tp operator^=(_Tp __op) volatile _NOEXCEPT {return fetch_xor(__op) ^ __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 994 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 995 | _Tp operator^=(_Tp __op) _NOEXCEPT {return fetch_xor(__op) ^ __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 996 | }; | 
|  | 997 |  | 
|  | 998 | // atomic<T> | 
|  | 999 |  | 
|  | 1000 | template <class _Tp> | 
|  | 1001 | struct atomic | 
|  | 1002 | : public __atomic_base<_Tp> | 
|  | 1003 | { | 
|  | 1004 | typedef __atomic_base<_Tp> __base; | 
|  | 1005 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 74f4da7 | 2013-05-02 20:18:43 | [diff] [blame] | 1006 | atomic() _NOEXCEPT _LIBCPP_DEFAULT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1007 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1008 | _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {} | 
| Howard Hinnant | d2f6afb | 2010-12-07 23:24:41 | [diff] [blame] | 1009 |  | 
|  | 1010 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1011 | _Tp operator=(_Tp __d) volatile _NOEXCEPT | 
| Howard Hinnant | d2f6afb | 2010-12-07 23:24:41 | [diff] [blame] | 1012 | {__base::store(__d); return __d;} | 
|  | 1013 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1014 | _Tp operator=(_Tp __d) _NOEXCEPT | 
| Howard Hinnant | d2f6afb | 2010-12-07 23:24:41 | [diff] [blame] | 1015 | {__base::store(__d); return __d;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1016 | }; | 
|  | 1017 |  | 
|  | 1018 | // atomic<T*> | 
|  | 1019 |  | 
|  | 1020 | template <class _Tp> | 
|  | 1021 | struct atomic<_Tp*> | 
|  | 1022 | : public __atomic_base<_Tp*> | 
|  | 1023 | { | 
| Howard Hinnant | d2f6afb | 2010-12-07 23:24:41 | [diff] [blame] | 1024 | typedef __atomic_base<_Tp*> __base; | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1025 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 74f4da7 | 2013-05-02 20:18:43 | [diff] [blame] | 1026 | atomic() _NOEXCEPT _LIBCPP_DEFAULT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1027 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1028 | _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1029 |  | 
|  | 1030 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1031 | _Tp* operator=(_Tp* __d) volatile _NOEXCEPT | 
| Howard Hinnant | d2f6afb | 2010-12-07 23:24:41 | [diff] [blame] | 1032 | {__base::store(__d); return __d;} | 
|  | 1033 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1034 | _Tp* operator=(_Tp* __d) _NOEXCEPT | 
| Howard Hinnant | d2f6afb | 2010-12-07 23:24:41 | [diff] [blame] | 1035 | {__base::store(__d); return __d;} | 
|  | 1036 |  | 
|  | 1037 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1038 | _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1039 | volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1040 | {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1041 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1042 | _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1043 | {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1044 | _LIBCPP_INLINE_VISIBILITY | 
|  | 1045 | _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1046 | volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1047 | {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1048 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1049 | _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1050 | {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1051 |  | 
|  | 1052 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1053 | _Tp* operator++(int) volatile _NOEXCEPT {return fetch_add(1);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1054 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1055 | _Tp* operator++(int) _NOEXCEPT {return fetch_add(1);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1056 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1057 | _Tp* operator--(int) volatile _NOEXCEPT {return fetch_sub(1);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1058 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1059 | _Tp* operator--(int) _NOEXCEPT {return fetch_sub(1);} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1060 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1061 | _Tp* operator++() volatile _NOEXCEPT {return fetch_add(1) + 1;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1062 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1063 | _Tp* operator++() _NOEXCEPT {return fetch_add(1) + 1;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1064 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1065 | _Tp* operator--() volatile _NOEXCEPT {return fetch_sub(1) - 1;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1066 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1067 | _Tp* operator--() _NOEXCEPT {return fetch_sub(1) - 1;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1068 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1069 | _Tp* operator+=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1070 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1071 | _Tp* operator+=(ptrdiff_t __op) _NOEXCEPT {return fetch_add(__op) + __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1072 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1073 | _Tp* operator-=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1074 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1075 | _Tp* operator-=(ptrdiff_t __op) _NOEXCEPT {return fetch_sub(__op) - __op;} | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1076 | }; | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1077 |  | 
|  | 1078 | // atomic_is_lock_free | 
|  | 1079 |  | 
|  | 1080 | template <class _Tp> | 
|  | 1081 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1082 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1083 | atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1084 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1085 | return __o->is_lock_free(); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1086 | } | 
|  | 1087 |  | 
|  | 1088 | template <class _Tp> | 
|  | 1089 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1090 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1091 | atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1092 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1093 | return __o->is_lock_free(); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1094 | } | 
|  | 1095 |  | 
|  | 1096 | // atomic_init | 
|  | 1097 |  | 
|  | 1098 | template <class _Tp> | 
|  | 1099 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1100 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1101 | atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1102 | { | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1103 | __c11_atomic_init(&__o->__a_, __d); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1104 | } | 
|  | 1105 |  | 
|  | 1106 | template <class _Tp> | 
|  | 1107 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1108 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1109 | atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1110 | { | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1111 | __c11_atomic_init(&__o->__a_, __d); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1112 | } | 
|  | 1113 |  | 
|  | 1114 | // atomic_store | 
|  | 1115 |  | 
|  | 1116 | template <class _Tp> | 
|  | 1117 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1118 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1119 | atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1120 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1121 | __o->store(__d); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1122 | } | 
|  | 1123 |  | 
|  | 1124 | template <class _Tp> | 
|  | 1125 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1126 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1127 | atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1128 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1129 | __o->store(__d); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1130 | } | 
|  | 1131 |  | 
|  | 1132 | // atomic_store_explicit | 
|  | 1133 |  | 
|  | 1134 | template <class _Tp> | 
|  | 1135 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1136 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1137 | atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1138 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1139 | __o->store(__d, __m); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1140 | } | 
|  | 1141 |  | 
|  | 1142 | template <class _Tp> | 
|  | 1143 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1144 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1145 | atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1146 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1147 | __o->store(__d, __m); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1148 | } | 
|  | 1149 |  | 
|  | 1150 | // atomic_load | 
|  | 1151 |  | 
|  | 1152 | template <class _Tp> | 
|  | 1153 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1154 | _Tp | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1155 | atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1156 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1157 | return __o->load(); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1158 | } | 
|  | 1159 |  | 
|  | 1160 | template <class _Tp> | 
|  | 1161 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1162 | _Tp | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1163 | atomic_load(const atomic<_Tp>* __o) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1164 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1165 | return __o->load(); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1166 | } | 
|  | 1167 |  | 
|  | 1168 | // atomic_load_explicit | 
|  | 1169 |  | 
|  | 1170 | template <class _Tp> | 
|  | 1171 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1172 | _Tp | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1173 | atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1174 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1175 | return __o->load(__m); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1176 | } | 
|  | 1177 |  | 
|  | 1178 | template <class _Tp> | 
|  | 1179 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1180 | _Tp | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1181 | atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1182 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1183 | return __o->load(__m); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1184 | } | 
|  | 1185 |  | 
|  | 1186 | // atomic_exchange | 
|  | 1187 |  | 
|  | 1188 | template <class _Tp> | 
|  | 1189 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1190 | _Tp | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1191 | atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1192 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1193 | return __o->exchange(__d); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1194 | } | 
|  | 1195 |  | 
|  | 1196 | template <class _Tp> | 
|  | 1197 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1198 | _Tp | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1199 | atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1200 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1201 | return __o->exchange(__d); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1202 | } | 
|  | 1203 |  | 
|  | 1204 | // atomic_exchange_explicit | 
|  | 1205 |  | 
|  | 1206 | template <class _Tp> | 
|  | 1207 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1208 | _Tp | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1209 | atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1210 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1211 | return __o->exchange(__d, __m); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1212 | } | 
|  | 1213 |  | 
|  | 1214 | template <class _Tp> | 
|  | 1215 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1216 | _Tp | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1217 | atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1218 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1219 | return __o->exchange(__d, __m); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1220 | } | 
|  | 1221 |  | 
|  | 1222 | // atomic_compare_exchange_weak | 
|  | 1223 |  | 
|  | 1224 | template <class _Tp> | 
|  | 1225 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1226 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1227 | atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1228 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1229 | return __o->compare_exchange_weak(*__e, __d); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1230 | } | 
|  | 1231 |  | 
|  | 1232 | template <class _Tp> | 
|  | 1233 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1234 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1235 | atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1236 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1237 | return __o->compare_exchange_weak(*__e, __d); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1238 | } | 
|  | 1239 |  | 
|  | 1240 | // atomic_compare_exchange_strong | 
|  | 1241 |  | 
|  | 1242 | template <class _Tp> | 
|  | 1243 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1244 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1245 | atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1246 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1247 | return __o->compare_exchange_strong(*__e, __d); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1248 | } | 
|  | 1249 |  | 
|  | 1250 | template <class _Tp> | 
|  | 1251 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1252 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1253 | atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1254 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1255 | return __o->compare_exchange_strong(*__e, __d); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1256 | } | 
|  | 1257 |  | 
|  | 1258 | // atomic_compare_exchange_weak_explicit | 
|  | 1259 |  | 
|  | 1260 | template <class _Tp> | 
|  | 1261 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1262 | bool | 
|  | 1263 | atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e, | 
|  | 1264 | _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1265 | memory_order __s, memory_order __f) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1266 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1267 | return __o->compare_exchange_weak(*__e, __d, __s, __f); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1268 | } | 
|  | 1269 |  | 
|  | 1270 | template <class _Tp> | 
|  | 1271 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1272 | bool | 
|  | 1273 | atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1274 | memory_order __s, memory_order __f) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1275 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1276 | return __o->compare_exchange_weak(*__e, __d, __s, __f); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1277 | } | 
|  | 1278 |  | 
|  | 1279 | // atomic_compare_exchange_strong_explicit | 
|  | 1280 |  | 
|  | 1281 | template <class _Tp> | 
|  | 1282 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1283 | bool | 
|  | 1284 | atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o, | 
|  | 1285 | _Tp* __e, _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1286 | memory_order __s, memory_order __f) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1287 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1288 | return __o->compare_exchange_strong(*__e, __d, __s, __f); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1289 | } | 
|  | 1290 |  | 
|  | 1291 | template <class _Tp> | 
|  | 1292 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1293 | bool | 
|  | 1294 | atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e, | 
|  | 1295 | _Tp __d, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1296 | memory_order __s, memory_order __f) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1297 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1298 | return __o->compare_exchange_strong(*__e, __d, __s, __f); | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1299 | } | 
|  | 1300 |  | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1301 | // atomic_fetch_add | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1302 |  | 
|  | 1303 | template <class _Tp> | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1304 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1305 | typename enable_if | 
|  | 1306 | < | 
|  | 1307 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1308 | _Tp | 
|  | 1309 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1310 | atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1311 | { | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1312 | return __o->fetch_add(__op); | 
|  | 1313 | } | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1314 |  | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1315 | template <class _Tp> | 
|  | 1316 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1317 | typename enable_if | 
|  | 1318 | < | 
|  | 1319 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1320 | _Tp | 
|  | 1321 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1322 | atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1323 | { | 
|  | 1324 | return __o->fetch_add(__op); | 
|  | 1325 | } | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1326 |  | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1327 | template <class _Tp> | 
|  | 1328 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1329 | _Tp* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1330 | atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1331 | { | 
|  | 1332 | return __o->fetch_add(__op); | 
|  | 1333 | } | 
|  | 1334 |  | 
|  | 1335 | template <class _Tp> | 
|  | 1336 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1337 | _Tp* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1338 | atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1339 | { | 
|  | 1340 | return __o->fetch_add(__op); | 
|  | 1341 | } | 
|  | 1342 |  | 
|  | 1343 | // atomic_fetch_add_explicit | 
|  | 1344 |  | 
|  | 1345 | template <class _Tp> | 
|  | 1346 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1347 | typename enable_if | 
|  | 1348 | < | 
|  | 1349 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1350 | _Tp | 
|  | 1351 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1352 | atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1353 | { | 
|  | 1354 | return __o->fetch_add(__op, __m); | 
|  | 1355 | } | 
|  | 1356 |  | 
|  | 1357 | template <class _Tp> | 
|  | 1358 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1359 | typename enable_if | 
|  | 1360 | < | 
|  | 1361 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1362 | _Tp | 
|  | 1363 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1364 | atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1365 | { | 
|  | 1366 | return __o->fetch_add(__op, __m); | 
|  | 1367 | } | 
|  | 1368 |  | 
|  | 1369 | template <class _Tp> | 
|  | 1370 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1371 | _Tp* | 
|  | 1372 | atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1373 | memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1374 | { | 
|  | 1375 | return __o->fetch_add(__op, __m); | 
|  | 1376 | } | 
|  | 1377 |  | 
|  | 1378 | template <class _Tp> | 
|  | 1379 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1380 | _Tp* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1381 | atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1382 | { | 
|  | 1383 | return __o->fetch_add(__op, __m); | 
|  | 1384 | } | 
|  | 1385 |  | 
|  | 1386 | // atomic_fetch_sub | 
|  | 1387 |  | 
|  | 1388 | template <class _Tp> | 
|  | 1389 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1390 | typename enable_if | 
|  | 1391 | < | 
|  | 1392 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1393 | _Tp | 
|  | 1394 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1395 | atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1396 | { | 
|  | 1397 | return __o->fetch_sub(__op); | 
|  | 1398 | } | 
|  | 1399 |  | 
|  | 1400 | template <class _Tp> | 
|  | 1401 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1402 | typename enable_if | 
|  | 1403 | < | 
|  | 1404 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1405 | _Tp | 
|  | 1406 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1407 | atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1408 | { | 
|  | 1409 | return __o->fetch_sub(__op); | 
|  | 1410 | } | 
|  | 1411 |  | 
|  | 1412 | template <class _Tp> | 
|  | 1413 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1414 | _Tp* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1415 | atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1416 | { | 
|  | 1417 | return __o->fetch_sub(__op); | 
|  | 1418 | } | 
|  | 1419 |  | 
|  | 1420 | template <class _Tp> | 
|  | 1421 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1422 | _Tp* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1423 | atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1424 | { | 
|  | 1425 | return __o->fetch_sub(__op); | 
|  | 1426 | } | 
|  | 1427 |  | 
|  | 1428 | // atomic_fetch_sub_explicit | 
|  | 1429 |  | 
|  | 1430 | template <class _Tp> | 
|  | 1431 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1432 | typename enable_if | 
|  | 1433 | < | 
|  | 1434 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1435 | _Tp | 
|  | 1436 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1437 | atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1438 | { | 
|  | 1439 | return __o->fetch_sub(__op, __m); | 
|  | 1440 | } | 
|  | 1441 |  | 
|  | 1442 | template <class _Tp> | 
|  | 1443 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1444 | typename enable_if | 
|  | 1445 | < | 
|  | 1446 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1447 | _Tp | 
|  | 1448 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1449 | atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1450 | { | 
|  | 1451 | return __o->fetch_sub(__op, __m); | 
|  | 1452 | } | 
|  | 1453 |  | 
|  | 1454 | template <class _Tp> | 
|  | 1455 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1456 | _Tp* | 
|  | 1457 | atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1458 | memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1459 | { | 
|  | 1460 | return __o->fetch_sub(__op, __m); | 
|  | 1461 | } | 
|  | 1462 |  | 
|  | 1463 | template <class _Tp> | 
|  | 1464 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1465 | _Tp* | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1466 | atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1467 | { | 
|  | 1468 | return __o->fetch_sub(__op, __m); | 
|  | 1469 | } | 
|  | 1470 |  | 
|  | 1471 | // atomic_fetch_and | 
|  | 1472 |  | 
|  | 1473 | template <class _Tp> | 
|  | 1474 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1475 | typename enable_if | 
|  | 1476 | < | 
|  | 1477 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1478 | _Tp | 
|  | 1479 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1480 | atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1481 | { | 
|  | 1482 | return __o->fetch_and(__op); | 
|  | 1483 | } | 
|  | 1484 |  | 
|  | 1485 | template <class _Tp> | 
|  | 1486 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1487 | typename enable_if | 
|  | 1488 | < | 
|  | 1489 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1490 | _Tp | 
|  | 1491 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1492 | atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1493 | { | 
|  | 1494 | return __o->fetch_and(__op); | 
|  | 1495 | } | 
|  | 1496 |  | 
|  | 1497 | // atomic_fetch_and_explicit | 
|  | 1498 |  | 
|  | 1499 | template <class _Tp> | 
|  | 1500 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1501 | typename enable_if | 
|  | 1502 | < | 
|  | 1503 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1504 | _Tp | 
|  | 1505 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1506 | atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1507 | { | 
|  | 1508 | return __o->fetch_and(__op, __m); | 
|  | 1509 | } | 
|  | 1510 |  | 
|  | 1511 | template <class _Tp> | 
|  | 1512 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1513 | typename enable_if | 
|  | 1514 | < | 
|  | 1515 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1516 | _Tp | 
|  | 1517 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1518 | atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1519 | { | 
|  | 1520 | return __o->fetch_and(__op, __m); | 
|  | 1521 | } | 
|  | 1522 |  | 
|  | 1523 | // atomic_fetch_or | 
|  | 1524 |  | 
|  | 1525 | template <class _Tp> | 
|  | 1526 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1527 | typename enable_if | 
|  | 1528 | < | 
|  | 1529 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1530 | _Tp | 
|  | 1531 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1532 | atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1533 | { | 
|  | 1534 | return __o->fetch_or(__op); | 
|  | 1535 | } | 
|  | 1536 |  | 
|  | 1537 | template <class _Tp> | 
|  | 1538 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1539 | typename enable_if | 
|  | 1540 | < | 
|  | 1541 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1542 | _Tp | 
|  | 1543 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1544 | atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1545 | { | 
|  | 1546 | return __o->fetch_or(__op); | 
|  | 1547 | } | 
|  | 1548 |  | 
|  | 1549 | // atomic_fetch_or_explicit | 
|  | 1550 |  | 
|  | 1551 | template <class _Tp> | 
|  | 1552 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1553 | typename enable_if | 
|  | 1554 | < | 
|  | 1555 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1556 | _Tp | 
|  | 1557 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1558 | atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1559 | { | 
|  | 1560 | return __o->fetch_or(__op, __m); | 
|  | 1561 | } | 
|  | 1562 |  | 
|  | 1563 | template <class _Tp> | 
|  | 1564 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1565 | typename enable_if | 
|  | 1566 | < | 
|  | 1567 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1568 | _Tp | 
|  | 1569 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1570 | atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1571 | { | 
|  | 1572 | return __o->fetch_or(__op, __m); | 
|  | 1573 | } | 
|  | 1574 |  | 
|  | 1575 | // atomic_fetch_xor | 
|  | 1576 |  | 
|  | 1577 | template <class _Tp> | 
|  | 1578 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1579 | typename enable_if | 
|  | 1580 | < | 
|  | 1581 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1582 | _Tp | 
|  | 1583 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1584 | atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1585 | { | 
|  | 1586 | return __o->fetch_xor(__op); | 
|  | 1587 | } | 
|  | 1588 |  | 
|  | 1589 | template <class _Tp> | 
|  | 1590 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1591 | typename enable_if | 
|  | 1592 | < | 
|  | 1593 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1594 | _Tp | 
|  | 1595 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1596 | atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1597 | { | 
|  | 1598 | return __o->fetch_xor(__op); | 
|  | 1599 | } | 
|  | 1600 |  | 
|  | 1601 | // atomic_fetch_xor_explicit | 
|  | 1602 |  | 
|  | 1603 | template <class _Tp> | 
|  | 1604 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1605 | typename enable_if | 
|  | 1606 | < | 
|  | 1607 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1608 | _Tp | 
|  | 1609 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1610 | atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1611 | { | 
|  | 1612 | return __o->fetch_xor(__op, __m); | 
|  | 1613 | } | 
|  | 1614 |  | 
|  | 1615 | template <class _Tp> | 
|  | 1616 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1617 | typename enable_if | 
|  | 1618 | < | 
|  | 1619 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | 
|  | 1620 | _Tp | 
|  | 1621 | >::type | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1622 | atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 91e2f26 | 2010-12-07 20:46:14 | [diff] [blame] | 1623 | { | 
|  | 1624 | return __o->fetch_xor(__op, __m); | 
|  | 1625 | } | 
| Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 | [diff] [blame] | 1626 |  | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1627 | // flag type and operations | 
|  | 1628 |  | 
|  | 1629 | typedef struct atomic_flag | 
|  | 1630 | { | 
| David Chisnall | 83b2c84 | 2011-12-19 11:44:20 | [diff] [blame] | 1631 | _Atomic(bool) __a_; | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1632 |  | 
|  | 1633 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1634 | bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1635 | {return __c11_atomic_exchange(&__a_, true, __m);} | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1636 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1637 | bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1638 | {return __c11_atomic_exchange(&__a_, true, __m);} | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1639 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1640 | void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1641 | {__c11_atomic_store(&__a_, false, __m);} | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1642 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1643 | void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1644 | {__c11_atomic_store(&__a_, false, __m);} | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1645 |  | 
|  | 1646 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 74f4da7 | 2013-05-02 20:18:43 | [diff] [blame] | 1647 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS | 
|  | 1648 | atomic_flag() _NOEXCEPT = default; | 
|  | 1649 | #else | 
|  | 1650 | atomic_flag() _NOEXCEPT : __a_() {} | 
|  | 1651 | #endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS | 
|  | 1652 |  | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1653 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1654 | atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1655 |  | 
|  | 1656 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS | 
|  | 1657 | atomic_flag(const atomic_flag&) = delete; | 
|  | 1658 | atomic_flag& operator=(const atomic_flag&) = delete; | 
|  | 1659 | atomic_flag& operator=(const atomic_flag&) volatile = delete; | 
|  | 1660 | #else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS | 
|  | 1661 | private: | 
|  | 1662 | atomic_flag(const atomic_flag&); | 
|  | 1663 | atomic_flag& operator=(const atomic_flag&); | 
|  | 1664 | atomic_flag& operator=(const atomic_flag&) volatile; | 
|  | 1665 | #endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS | 
|  | 1666 | } atomic_flag; | 
|  | 1667 |  | 
|  | 1668 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1669 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1670 | atomic_flag_test_and_set(volatile atomic_flag* __o) _NOEXCEPT | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1671 | { | 
|  | 1672 | return __o->test_and_set(); | 
|  | 1673 | } | 
|  | 1674 |  | 
|  | 1675 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1676 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1677 | atomic_flag_test_and_set(atomic_flag* __o) _NOEXCEPT | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1678 | { | 
|  | 1679 | return __o->test_and_set(); | 
|  | 1680 | } | 
|  | 1681 |  | 
|  | 1682 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1683 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1684 | atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1685 | { | 
|  | 1686 | return __o->test_and_set(__m); | 
|  | 1687 | } | 
|  | 1688 |  | 
|  | 1689 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1690 | bool | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1691 | atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1692 | { | 
|  | 1693 | return __o->test_and_set(__m); | 
|  | 1694 | } | 
|  | 1695 |  | 
|  | 1696 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1697 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1698 | atomic_flag_clear(volatile atomic_flag* __o) _NOEXCEPT | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1699 | { | 
|  | 1700 | __o->clear(); | 
|  | 1701 | } | 
|  | 1702 |  | 
|  | 1703 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1704 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1705 | atomic_flag_clear(atomic_flag* __o) _NOEXCEPT | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1706 | { | 
|  | 1707 | __o->clear(); | 
|  | 1708 | } | 
|  | 1709 |  | 
|  | 1710 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1711 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1712 | atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1713 | { | 
|  | 1714 | __o->clear(__m); | 
|  | 1715 | } | 
|  | 1716 |  | 
|  | 1717 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1718 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1719 | atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1720 | { | 
|  | 1721 | __o->clear(__m); | 
|  | 1722 | } | 
|  | 1723 |  | 
|  | 1724 | // fences | 
|  | 1725 |  | 
|  | 1726 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1727 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1728 | atomic_thread_fence(memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1729 | { | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1730 | __c11_atomic_thread_fence(__m); | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1731 | } | 
|  | 1732 |  | 
|  | 1733 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1734 | void | 
| Howard Hinnant | 300c67a | 2012-04-11 20:14:21 | [diff] [blame] | 1735 | atomic_signal_fence(memory_order __m) _NOEXCEPT | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1736 | { | 
| Richard Smith | 6186c7f | 2012-04-11 18:55:46 | [diff] [blame] | 1737 | __c11_atomic_signal_fence(__m); | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1738 | } | 
|  | 1739 |  | 
| Howard Hinnant | d2f6afb | 2010-12-07 23:24:41 | [diff] [blame] | 1740 | // Atomics for standard typedef types | 
|  | 1741 |  | 
| Howard Hinnant | 6ae4705 | 2013-01-04 18:58:50 | [diff] [blame] | 1742 | typedef atomic<bool> atomic_bool; | 
| Howard Hinnant | d2f6afb | 2010-12-07 23:24:41 | [diff] [blame] | 1743 | typedef atomic<char> atomic_char; | 
|  | 1744 | typedef atomic<signed char> atomic_schar; | 
|  | 1745 | typedef atomic<unsigned char> atomic_uchar; | 
|  | 1746 | typedef atomic<short> atomic_short; | 
|  | 1747 | typedef atomic<unsigned short> atomic_ushort; | 
|  | 1748 | typedef atomic<int> atomic_int; | 
|  | 1749 | typedef atomic<unsigned int> atomic_uint; | 
|  | 1750 | typedef atomic<long> atomic_long; | 
|  | 1751 | typedef atomic<unsigned long> atomic_ulong; | 
|  | 1752 | typedef atomic<long long> atomic_llong; | 
|  | 1753 | typedef atomic<unsigned long long> atomic_ullong; | 
|  | 1754 | typedef atomic<char16_t> atomic_char16_t; | 
|  | 1755 | typedef atomic<char32_t> atomic_char32_t; | 
|  | 1756 | typedef atomic<wchar_t> atomic_wchar_t; | 
|  | 1757 |  | 
|  | 1758 | typedef atomic<int_least8_t> atomic_int_least8_t; | 
|  | 1759 | typedef atomic<uint_least8_t> atomic_uint_least8_t; | 
|  | 1760 | typedef atomic<int_least16_t> atomic_int_least16_t; | 
|  | 1761 | typedef atomic<uint_least16_t> atomic_uint_least16_t; | 
|  | 1762 | typedef atomic<int_least32_t> atomic_int_least32_t; | 
|  | 1763 | typedef atomic<uint_least32_t> atomic_uint_least32_t; | 
|  | 1764 | typedef atomic<int_least64_t> atomic_int_least64_t; | 
|  | 1765 | typedef atomic<uint_least64_t> atomic_uint_least64_t; | 
|  | 1766 |  | 
|  | 1767 | typedef atomic<int_fast8_t> atomic_int_fast8_t; | 
|  | 1768 | typedef atomic<uint_fast8_t> atomic_uint_fast8_t; | 
|  | 1769 | typedef atomic<int_fast16_t> atomic_int_fast16_t; | 
|  | 1770 | typedef atomic<uint_fast16_t> atomic_uint_fast16_t; | 
|  | 1771 | typedef atomic<int_fast32_t> atomic_int_fast32_t; | 
|  | 1772 | typedef atomic<uint_fast32_t> atomic_uint_fast32_t; | 
|  | 1773 | typedef atomic<int_fast64_t> atomic_int_fast64_t; | 
|  | 1774 | typedef atomic<uint_fast64_t> atomic_uint_fast64_t; | 
|  | 1775 |  | 
|  | 1776 | typedef atomic<intptr_t> atomic_intptr_t; | 
|  | 1777 | typedef atomic<uintptr_t> atomic_uintptr_t; | 
|  | 1778 | typedef atomic<size_t> atomic_size_t; | 
|  | 1779 | typedef atomic<ptrdiff_t> atomic_ptrdiff_t; | 
|  | 1780 | typedef atomic<intmax_t> atomic_intmax_t; | 
|  | 1781 | typedef atomic<uintmax_t> atomic_uintmax_t; | 
|  | 1782 |  | 
| Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 | [diff] [blame] | 1783 | #define ATOMIC_FLAG_INIT {false} | 
| Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 | [diff] [blame] | 1784 | #define ATOMIC_VAR_INIT(__v) {__v} | 
|  | 1785 |  | 
| Howard Hinnant | 7b9d6a8 | 2013-01-21 20:39:41 | [diff] [blame] | 1786 | #define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE | 
|  | 1787 | #define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE | 
|  | 1788 | #define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE | 
|  | 1789 | #define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE | 
|  | 1790 | #define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE | 
|  | 1791 | #define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE | 
|  | 1792 | #define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE | 
|  | 1793 | #define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE | 
|  | 1794 | #define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE | 
|  | 1795 | #define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE | 
| Howard Hinnant | 770d1c4 | 2010-12-08 17:20:28 | [diff] [blame] | 1796 |  | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 1797 | _LIBCPP_END_NAMESPACE_STD | 
|  | 1798 |  | 
| Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 | [diff] [blame] | 1799 | #endif // _LIBCPP_ATOMIC |